<?php
//管理员模型
namespace King\Model;
use Think\Model;

/**
 * 用户模型
 */
class withdrawModel extends Model{
    
    protected $tableName = 'withdraw';

    /**
     * 自动完成
     * @var array
     */
    protected $_auto = array(
    );
    

    /*
     * 自动验证
     */
    protected $_validate = array(
     );
    
    /*
     * 获取列表
     */
    public function getWithdrawList($where,$page){
       $res = $this->where($where)->order('atm_id DESC')->page($page,100)->select();
        return $res;
    }
    
    
    /*
     * 获取列表
     */
    public function getWithdrawLists($where){
        $res = $this->where($where)->order('atm_id DESC')->select();
        return $res;
    }
	
    /*
     * 统计数量
     */
    public function getWithdrawCount($where){
        $res = $this->where($where)->count();
        return $res;
    }
    
    /*
     * 添加
     */
    public function addWithdraw($data){
        $res = $this->add($data);
        return $res;
    }
    
    /*
     * 获取信息
     */
    public function getWithdraw($where){
        $res = $this->where($where)->find();
        return $res;
    }
	
    /*
     * 编辑信息
     */
    public function editWithdraw($where,$data){
        return $this->where($where)->save($data);
    }
    
    /*
     * 计算总共提现总额和手续费
     */
    public function sumTixian(){
        $where = array(
            'status' => array('NEQ','2'),
        );
        $res['withdraw_money'] = $this->where($where)->sum('withdraw_money');
        $res['shouxufei'] = $this->where($where)->sum('shouxufei');
        return $res;
    }
    
    
}
